package com.demo.service.impl;

import com.demo.dao.UserDao;
import com.demo.dao.impl.UserDaoImpl;
import com.demo.pojo.User;
import com.demo.service.UserService;

import java.util.List;

/**
 * @author wzm
 * @create 2023-05-04 10:13
 */
public class UserServiceImpl implements UserService {
    //UserServiceImpl访问Dao实现
    private UserDao userDao = new UserDaoImpl();

    @Override
    public User login(User user) {
        return userDao.selectByUserAndPassWord(user);
    }

    @Override
    public boolean register(User user) {
        //受影响行数 > 0 成功
        return userDao.insert(user) > 0;
    }

    @Override
    public List<User> findByLikeName(User user) {
        return userDao.selectByLikeName(user);
    }
}

